Skip to content

feat: added manacher algorithm#178

Merged
siriak merged 2 commits into
TheAlgorithms:masterfrom
Arpita23r:feat/manacher-arpi23r
Oct 11, 2025
Merged

feat: added manacher algorithm#178
siriak merged 2 commits into
TheAlgorithms:masterfrom
Arpita23r:feat/manacher-arpi23r

Conversation

@Arpita23r
Copy link
Copy Markdown
Contributor

@Arpita23r Arpita23r commented Oct 9, 2025

  • Implemented Manacher's Algorithm in R to find the longest palindromic substring.
  • Efficient linear-time solution (O(n)) compared to naive O(n^3) approaches.
  • Handles both odd and even length palindromes using modified string representation.
  • Returns the actual substring instead of just the length.
  • Added clear variable names and inline comments for readability.
  • Supports case-insensitive input for flexible string matching.
  • Stored file under string_manipulation/manacher.longest.palindrome.R following project structure conventions.

@siriak siriak requested a review from Copilot October 11, 2025 09:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Manacher's algorithm for finding the longest palindromic substring in R, providing an efficient O(n) solution compared to naive O(n³) approaches. The implementation handles both odd and even length palindromes using a modified string representation with separators.

  • Implements linear-time Manacher's algorithm for palindrome detection
  • Uses string preprocessing with '#' separators to handle even-length palindromes
  • Includes interactive input functionality with case-insensitive processing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread string_manipulation/manacher.longest.palindrome.R
Comment thread string_manipulation/manacher.longest.palindrome.R
Comment thread string_manipulation/manacher.longest.palindrome.R
Copy link
Copy Markdown
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@siriak siriak merged commit 7ca7e95 into TheAlgorithms:master Oct 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants